// import { Agent, PersonalPronoun, PersonalPronounNames } from "./Agent";
// import I, { Styles } from "./Interactive";
// import { Interpreter } from "./Interpreter";
// import { TestRoomA } from "./TestScene";
// import { UniversalImperatives, World } from "./WorldBase";
// import { Report, ReportType } from "./Definitions";
// import { U } from "./Util";

// export const VERSION_STORY = 'pre-alpha test 0.1';

// let protagonist = new Agent('O', PersonalPronoun.You, TestRoomA);
// let interpreter = new Interpreter(protagonist);

// export async function Main() {
//     I.printCentered(`
//  _____   _____         __   __ _______ _     _  _____   ______  _____  _______
// |_____] |     | |        \\_/   |       |_____| |     | |_____/ |     | |______
// |       |_____| |_____    |    |_____  |     | |_____| |    \\_ |_____| ______|\n`, false);
//     I.printCentered("*流  形*\n\n测试版本（pre-alpha）\n\n");
//     I.printCentered(
//         "... há noite antes e após       \n" +
//         "O pouco que duramos.            \n\n" +
//         "                          Ricardo Reis (1924)\n\n");

//     await I.getKey("按任意键继续。\n");
    
//     I.printCentered("*测试程序*", true, Styles.Meta);

//     protagonist.memory.callback = printReports;
//     World.schedule.addAction(protagonist.healthCoroutine(), protagonist);
//     inputLoop();
// }

// let lastGroup = '', lastAnnotation = false, 
//     firstReport = true, lastTime = -1;
// function printContextRenew() {
//     lastGroup = '';
//     lastAnnotation = false;
//     firstReport = true;
//     lastTime = -1;
// }

// function printReports(r: Report, t: number) {
//     let style = Styles.Default;
//     if (r.type == ReportType.Meta) style = Styles.Meta;
//     if (!(r.group == lastGroup && lastGroup != '') && !firstReport && !lastAnnotation)
//         I.print('\n\n');
//     let text = r.narration.second;
//     if (r.from instanceof Agent)
//         text = text.replace('@', PersonalPronounNames[r.from.pronoun]);
//     I.print(text, true, style);

//     firstReport = false;
//     lastGroup = r.group;
//     lastAnnotation = r.type == ReportType.Annotation;
//     if (!lastAnnotation)
//         I.print(`｜`, true, Styles.Comment);
//     lastTime = t;
// }

// async function inputLoop() {
//     while (true) {
//         I.setHeader(protagonist.parentZone.name);

//         let input = await I.input("\n\n>> ");
//         let entry = World.schedule.addAction(interpreter.parseCommand(input), protagonist);
//         while (!entry.delete) {
//             let c = UniversalImperatives.passTimeUntil(entry.nextTime);
//             input = '';
//             while (true) {
//                 printContextRenew();
//                 let result = c.next(input);
//                 if (result.done) break;
//                 I.print('\n\n' + result.value.narration.second, true, Styles.Meta);
//                 input = await I.input();
//             }
//         }
//     }
// }